/*
 * Copyright (c) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef STRM_MSG_SK_H
#define STRM_MSG_SK_H

#include <stdint.h>
#include "hi_misc_util.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
    Stream Message Socket type.
*/
typedef struct StrmMsgSk StrmMsgSk;

/**
    StrmMsgSk create.

    @param sock[in]: 已经建立的stream连接。
*/
int SmsCreate(StrmMsgSk** sk, int sock, uint32_t maxRxMsgSize, uint32_t maxRxListSize);

/**
    StrmMsgSk destroy.
*/
void SmsDestroy(StrmMsgSk* self);

/**
    异步发送消息.
*/
int SmsSend(StrmMsgSk* self, MemBlk* msg);

/**
    异步接收消息.
*/
int SmsRecv(StrmMsgSk* self, MemBlk** msg);

/**
    获得可监视send fd.
*/
int SmsSendFd(StrmMsgSk* self);

/**
    获得可监视recv fd.
*/
int SmsRecvFd(StrmMsgSk* self);

#ifdef __cplusplus
}
#endif

#endif // STRM_MSG_SK_H
